import axios from 'axios'
// let base = 'http://localhost:8081/';
// let ext = ''
let base = '';
let ext = '.json'
export const getRequest = (url,params) => {
  return axios({
    method: 'get',
    data:params,
    transformRequest: [function (data) {
      let ret = ''
      for (let it in data) {
        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
      }
      return ret
    }],
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: `${base}${url}${ext}`
  });
}

export const showMsgTitle = (_this,msg) => {
  _this.$message(msg+"成功");
}
export const showMsgConfirm = (_this,msg) => {
    _this.$confirm('此操作将'+msg+',是否继续?', '提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(() => {
      _this.$message({
        type: 'success',
        message: '成功!'
      });
    }).catch(() => {
      _this.$message({
        type: 'info',
        message: '已取消'
      });
    });
}
